<!-- 该操作将清理所有用户数据，且不可恢复，请谨慎处理。 -->
<template>
    <div class="app-container">
        <h2>该操作将清理所有用户数据，且不可恢复，请谨慎处理。</h2>
        <el-button type="primary" :loading="boolLoading" @click="resetAll"
            >数据初始化</el-button
        >
    </div>
</template>

<script>
import { getInfo, initData } from "@/api/login";

export default {
    data() {
        return {
            boolLoading: false,
        };
    },
    methods: {
        resetAll() {
            this.$confirm("是否清理用户数据？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    this.loading = true;

                    initData()
                        .then(() => {
                            this.$message.success("数据初始化成功");
                            this.loading = false;
                        })
                        .catch(() => {
                            this.$message.error("数据初始化失败");
                            this.loading = false;
                        });
                })
                .catch(() => {});
        },
    },
};
</script>

<style scoped>
.app-container {
    width: 100%;
    height: calc(100vh - 50px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

h2 {
    margin-bottom: 20px;
    font-size: 36px;
    color: #333;
}

p {
    margin-bottom: 30px;
    font-size: 18px;
    color: #666;
}

ul {
    padding-left: 20px;
}

li {
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

button {
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 18px;
    color: #fff;
    background-color: #4caf50;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

button:hover {
    background-color: #45a049;
    transform: scale(1.05);
}
</style>
